﻿<%@ Page Title="MembershipUser Details" Language="C#" MasterPageFile="~/Views/Shared/OneCol.Master" AutoEventWireup="true" CodeBehind="Index.aspx.cs" Inherits="StarterKits.Mvc.Membership.Views.Profiles.Index" %>
<%@ Import Namespace="P.InOut.NetMvc.Models" %>

<asp:Content ID="Scripts" ContentPlaceHolderID="Scripts" runat="server">
<script type="text/javascript">

    $(document).ready(function() {

        $("#birthdate").mask("99/99/9999");
        $("#officePhone").mask("(999) 999-9999");
        $("#remotePhone").mask("(999) 999-9999");
    });
        
</script>
</asp:Content>

<asp:Content ID="content" ContentPlaceHolderID="Col1" runat="server">
<h2><%= ViewData.Model.User.UserName %></h2>


<% if ((TempData["SuccessMessage"] ?? ViewData["SuccessMessage"]) != null) { %>
<p class="MvcMembershipError"><% =(string)TempData["SuccessMessage"] ?? (string)ViewData["SuccessMessage"] %></p>
<% } %>

<% using(Html.Form<P.InOut.NetMvc.Controllers.ProfilesController>(x => x.Update(ViewData.Model.User.ProviderUserKey))) { %>
<fieldset class="MvcMembership">
	<legend>User Profile</legend>

	<div>
	<%= Html.Hidden("RequestFrom", "Profiles") %>
	<% =Html.Hidden("UserName", ViewData.Model.User.UserName) %>
	<label for="firstName">First Name</label>
	<div><%= Html.TextBox( "firstName", ViewData.Model.Profile.FirstName == null ? string.Empty :
                ViewData.Model.Profile.FirstName, new { maxLength = "60" })%></div>
	</div>
	
	<div>
	<label for="lastName">Last Name</label>
	<div><%= Html.TextBox( "lastName", ViewData.Model.Profile.LastName == null ? string.Empty :
                ViewData.Model.Profile.LastName, new { maxLength = "100" })%></div>
	</div>
	
	<div>
	<label for="birthdate">Birthdate</label>
	<div><%= Html.TextBox( "birthdate", ViewData.Model.Profile.Birthdate == null ? string.Empty :
                ViewData.Model.Profile.Birthdate.Value.ToString("M/dd/yyyy"), new { maxLength = "128" })%></div>
	</div>

	<div>
	<label for="officePhone">Office Phone</label>
	<div><%= Html.TextBox( "officePhone", 
	         ViewData.Model.Profile.OfficePhone, new { maxLength="128" }) %></div>
	</div>

	<div>
	<label for="remotePhone">Remote Phone</label>
	<div><%= Html.TextBox( "remotePhone", 
	    ViewData.Model.Profile.RemotePhone, new { maxLength="128" }) %></div>
	</div>

	<div><%= Html.SubmitButton( "Update User Profile" ) %></div>

</fieldset>
<% } %>

</asp:Content>
